class Shape(object):
    def __init__(self,color):
        self.__color = color
    def area(self):
        raise NotImplementedError("该方法必须被实现")

class Rectangle(Shape):
    def __init__(self,color,height,width):
        super().__init__(color)
        if height >0  and  width > 0:
            self.__height = height
            self.__width = width
        else:
            raise ValueError("宽高必须>0")
    def area(self):
        print(self.__height*self.__width)
    def get_height(self):
        return self.__height
    def get_width(self):
        return self.__width
    def set_height(self,height):
        self.__height = height
    def set_width(self,width):
        self.__width = width

class Cube(Rectangle):
    def __init__(self,color,height,width,length):
        self.__length = length
        super().__init__(color,height,width)
    def area(self):
        print((self.__length*self.get_height()+self.__length*self.get_width()+self.get_height()*self.get_width())*2)
    def volume(self):
        print(self.__length*self.get_height()*self.get_width())

a = Rectangle("red",20,20)
a.area()

b = Cube("blue",20,20,20)
b.area()
b.volume()